package com.management.service.wes.impl;

import com.management.common.ServerResponse;
import com.management.dao.wes.PurTbRcvMapper;
import com.management.dao.wes.PurTbRcvdMapper;
import com.management.pojo.wes.PurTbRcv;
import com.management.pojo.wes.PurTbRcvd;
import com.management.service.wes.IPurTbRcvdService;
import com.management.util.DataSourceContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(value="transactionManager_wes", readOnly=false)
public class PurTbRcvdServiceImpl
        implements IPurTbRcvdService
{
    @Autowired
    PurTbRcvMapper purTbRcvMapper;
    @Autowired
    PurTbRcvdMapper purTbRcvdMapper;

    public ServerResponse deletePurTbRcv(PurTbRcv purTbRcv)
    {
        DataSourceContextHolder.setDbType("wes");
        int i = this.purTbRcvMapper.deletePurTbRcv(purTbRcv);
        if (i > 0) {
            return ServerResponse.createBySuccessMsg("删除成功");
        }
        return ServerResponse.createByErrorMessage("删除失败");
    }

    public ServerResponse deletePurTbRcvd(PurTbRcvd purTbRcvd)
    {
        DataSourceContextHolder.setDbType("wes");
        int i = this.purTbRcvdMapper.deletePurTbRcvd(purTbRcvd);
        if (i > 0) {
            return ServerResponse.createBySuccessMsg("删除成功");
        }
        return ServerResponse.createByErrorMessage("删除失败");
    }
}
